home *** CD-ROM | disk | FTP | other *** search
- #include "VCRplus.h"
-
- /* function that performs initial scrambling */
- long mixup(long x, long y)
- {
- long i, j, k, sum;
-
- long a[12], b[12], out[12] ;
-
- /* get the digits of x into a[] */
- j = x ;
- for(i=0; i<9; i++)
- {
- k = j % 10;
- a[i] = k;
- j = (j - k) / 10 ;
- }
-
- /* get the digits of y into b[] */
- j = y ;
- for(i=0; i<9; i++)
- {
- k = j % 10;
- b[i] = k;
- j = (j - k) / 10 ;
- out[i] = 0;
- }
-
-
- for(i=0; i<=8; i++)
- {
- for(j=0; j<=8; j++)
- {
- out[i+j] += (b[j] * a[i]) ;
- }
- }
-
- j = 1;
- sum = 0;
- for(i=0; i<=8; i++)
- {
- sum += j * (out[i] % 10);
- j = j * 10 ;
- }
- return( sum ) ;
- }
-